// TOWN SCRIPT
//    Town 24: Hengest

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
	set_name(7,"Faust");
	set_horse_property(0,1);
	set_horse_property(1,1);
	set_state_continue(15);
break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// This state is called every turn the party is in this town.
break;

beginstate 10;
	if (get_flag(24,0) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"Fire and smoke rise from the fortress. An air of eerie quiet lies upon the high plateau.",0);
	add_dialog_str(1,"Staring balefully down at you with hollow eyes, the castle is lifeless and still, save for the ravens that circle overhead about a black flag with a draconian emblem.",0);	
	add_dialog_str(2,"Hengest has fallen.",0);
	add_dialog_str(3,"Strange, though: no soldiers stand on guard anywhere that you can see, and you detect no hidden menace. Evidently, there is no garrison at all. You wonder where the assailant force might have gone.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	set_flag(24,0,250);
break;

beginstate 11;
	if (get_flag(24,1) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"Suddenly, from beneath the earth comes a tremendous shaking. The floor cracks, opening into a wide chasm. Fiery spirits surge up from the abyss. Faust looks on with a remote but resigned look on his face.",0);
	add_dialog_str(1,"A great power rises from the chasm. Shaped as a mighty demon, the master of the abyss reaches a hand out toward Faust. Inch by inch, as though against his will, Faust raises his hand to meet it.",0);
	add_dialog_str(2,"A flash of shadows. Faust is gone. The demon stares at you momentarily. Then it laughs, a sound utterly unlike to the voice of Faust that you heard earlier. Deep and scornful, its laughter shakes the foundations of the castle.",0);
	add_dialog_str(3,"_Flee, wormlings! Flee to your precious masters! The true rulers of this realm are waking again. This is no time for you, now. Flee, or be accursed!_",0);
	add_dialog_str(4,"Its voice reaches a terrifying crescendo. A blast of thunder from without. The quaking stones answer back.",0);
	add_dialog_str(5,"Perhaps it is time to leave.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);

	set_flag(24,1,250);
	activate_hidden_group(1);
	make_town_hostile();
	set_flag(24,2,1);
	erase_char(7);
break;

beginstate 15;
	if (get_flag(24,2) >= 1)
		set_state_continue(16);
	set_state_continue(10);
break;

beginstate 16;
	i = 6;
	while (i < NUM_CHARS) {
		erase_char(i);
		i = i + 1;
		}
break;


beginstate 18;
	if (get_flag(124,6) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"On the far side of the hall, a red-clad figure sits calmly on the throne, seemingly not troubled at all by your arrival, but seemingly almost resigned. Leaning back, he regards you with vacant eyes.",0);
	add_dialog_str(1,"_Go to the mines, outlanders,_ he says, his words carrying across strangely. You can detect a faint shaking in his voice, but it is quickly masked. _There is a future in front of you, however slim. Go to the iron mines of the west, and leave me be._",0);
	add_dialog_choice(0,"Leave.");
	choice = run_dialog(1);
	set_flag(124,6,250);
break;

